gtkwindow: Ignore implicit grabs going away if there is no focus
authorCarlos Garnacho <carlosg@gnome.org>
Sat, 1 Apr 2017 20:41:23 +0000 (22:41 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Thu, 25 May 2017 14:25:59 +0000 (16:25 +0200)
There should be no circumstances where an implicit grab is requested but
no focus exists, there's however circumstances (like windowing grabs taking
input to a different window) where we might get implicit grabs being undone
when then new window didn't create a focus for the pointer itself.

gtk/gtkwindow.c

index f0e8f07125d1d4ba5a730caa2749d200880adff8..5868265f507e010f0b46b351c5ef8e9ef680dc3b 100644 (file)
@@ -11507,6 +11507,8 @@ gtk_window_set_pointer_focus_grab (GtkWindow        *window,
   GtkPointerFocus *focus;
 
   focus = gtk_window_lookup_pointer_focus (window, device, sequence);
+  if (!focus && !grab_widget)
+    return;
   g_assert (focus != NULL);
   gtk_pointer_focus_set_implicit_grab (focus, grab_widget);
 }